// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A [Secret][google.cloud.secretmanager.v1.Secret] is a logical secret whose
/// value and versions can be accessed.
///
/// A [Secret][google.cloud.secretmanager.v1.Secret] is made up of zero or more
/// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] that represent
/// the secret data.
///
/// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
/// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Secret {
    /// Output only. The resource name of the
    /// [Secret][google.cloud.secretmanager.v1.Secret] in the format
    /// `projects/*/secrets/*`.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub name: std::string::String,

    /// Optional. Immutable. The replication policy of the secret data attached to
    /// the [Secret][google.cloud.secretmanager.v1.Secret].
    ///
    /// The replication policy cannot be changed after the Secret has been created.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub replication: std::option::Option<crate::model::Replication>,

    /// Output only. The time at which the
    /// [Secret][google.cloud.secretmanager.v1.Secret] was created.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// The labels assigned to this Secret.
    ///
    /// Label keys must be between 1 and 63 characters long, have a UTF-8 encoding
    /// of maximum 128 bytes, and must conform to the following PCRE regular
    /// expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`
    ///
    /// Label values must be between 0 and 63 characters long, have a UTF-8
    /// encoding of maximum 128 bytes, and must conform to the following PCRE
    /// regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`
    ///
    /// No more than 64 labels can be assigned to a given resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. A list of up to 10 Pub/Sub topics to which messages are published
    /// when control plane operations are called on the secret or its versions.
    pub topics: std::vec::Vec<crate::model::Topic>,

    /// Optional. Etag of the currently stored
    /// [Secret][google.cloud.secretmanager.v1.Secret].
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub etag: std::string::String,

    /// Optional. Rotation policy attached to the
    /// [Secret][google.cloud.secretmanager.v1.Secret]. May be excluded if there is
    /// no rotation policy.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub rotation: std::option::Option<crate::model::Rotation>,

    /// Optional. Mapping from version alias to version name.
    ///
    /// A version alias is a string with a maximum length of 63 characters and can
    /// contain uppercase and lowercase letters, numerals, and the hyphen (`-`)
    /// and underscore ('_') characters. An alias string must start with a
    /// letter and cannot be the string 'latest' or 'NEW'.
    /// No more than 50 aliases can be assigned to a given secret.
    ///
    /// Version-Alias pairs will be viewable via GetSecret and modifiable via
    /// UpdateSecret. Access by alias is only be supported on
    /// GetSecretVersion and AccessSecretVersion.
    pub version_aliases: std::collections::HashMap<std::string::String, i64>,

    /// Optional. Custom metadata about the secret.
    ///
    /// Annotations are distinct from various forms of labels.
    /// Annotations exist to allow client tools to store their own state
    /// information without requiring a database.
    ///
    /// Annotation keys must be between 1 and 63 characters long, have a UTF-8
    /// encoding of maximum 128 bytes, begin and end with an alphanumeric character
    /// ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and
    /// alphanumerics in between these symbols.
    ///
    /// The total size of annotation keys and values must be less than 16KiB.
    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. Secret Version TTL after destruction request
    ///
    /// This is a part of the Delayed secret version destroy feature.
    /// For secret with TTL>0, version destruction doesn't happen immediately
    /// on calling destroy instead the version goes to a disabled state and
    /// destruction happens after the TTL expires.
    pub version_destroy_ttl: std::option::Option<wkt::Duration>,

    /// Optional. The customer-managed encryption configuration of the regionalized
    /// secrets. If no configuration is provided, Google-managed default encryption
    /// is used.
    ///
    /// Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption
    /// configuration only apply to
    /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added
    /// afterwards. They do not apply retroactively to existing
    /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub customer_managed_encryption: std::option::Option<crate::model::CustomerManagedEncryption>,

    /// Optional. Input only. Immutable. Mapping of Tag keys/values directly bound
    /// to this resource. For example:
    /// "123/environment": "production",
    /// "123/costCenter": "marketing"
    ///
    /// Tags are used to organize and group resources.
    ///
    /// Tags can be used to control policy evaluation for the resource.
    pub tags: std::collections::HashMap<std::string::String, std::string::String>,

    /// Expiration policy attached to the
    /// [Secret][google.cloud.secretmanager.v1.Secret]. If specified the
    /// [Secret][google.cloud.secretmanager.v1.Secret] and all
    /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be
    /// automatically deleted at expiration. Expired secrets are irreversibly
    /// deleted.
    ///
    /// Expiration is *not* the recommended way to set time-based permissions. [IAM
    /// Conditions](https://cloud.google.com/secret-manager/docs/access-control#conditions)
    /// is recommended for granting time-based permissions because the operation
    /// can be reversed.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub expiration: std::option::Option<crate::model::secret::Expiration>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Secret {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Secret::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// let x = Secret::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [replication][crate::model::Secret::replication].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::Replication;
    /// let x = Secret::new().set_replication(Replication::default()/* use setters */);
    /// ```
    pub fn set_replication<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Replication>,
    {
        self.replication = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [replication][crate::model::Secret::replication].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::Replication;
    /// let x = Secret::new().set_or_clear_replication(Some(Replication::default()/* use setters */));
    /// let x = Secret::new().set_or_clear_replication(None::<Replication>);
    /// ```
    pub fn set_or_clear_replication<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Replication>,
    {
        self.replication = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::Secret::create_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use wkt::Timestamp;
    /// let x = Secret::new().set_create_time(Timestamp::default()/* use setters */);
    /// ```
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Secret::create_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use wkt::Timestamp;
    /// let x = Secret::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
    /// let x = Secret::new().set_or_clear_create_time(None::<Timestamp>);
    /// ```
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Secret::labels].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// let x = Secret::new().set_labels([
    ///     ("key0", "abc"),
    ///     ("key1", "xyz"),
    /// ]);
    /// ```
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [topics][crate::model::Secret::topics].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::Topic;
    /// let x = Secret::new()
    ///     .set_topics([
    ///         Topic::default()/* use setters */,
    ///         Topic::default()/* use (different) setters */,
    ///     ]);
    /// ```
    pub fn set_topics<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Topic>,
    {
        use std::iter::Iterator;
        self.topics = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [etag][crate::model::Secret::etag].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// let x = Secret::new().set_etag("example");
    /// ```
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [rotation][crate::model::Secret::rotation].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::Rotation;
    /// let x = Secret::new().set_rotation(Rotation::default()/* use setters */);
    /// ```
    pub fn set_rotation<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Rotation>,
    {
        self.rotation = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rotation][crate::model::Secret::rotation].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::Rotation;
    /// let x = Secret::new().set_or_clear_rotation(Some(Rotation::default()/* use setters */));
    /// let x = Secret::new().set_or_clear_rotation(None::<Rotation>);
    /// ```
    pub fn set_or_clear_rotation<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Rotation>,
    {
        self.rotation = v.map(|x| x.into());
        self
    }

    /// Sets the value of [version_aliases][crate::model::Secret::version_aliases].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// let x = Secret::new().set_version_aliases([
    ///     ("key0", 123),
    ///     ("key1", 456),
    /// ]);
    /// ```
    pub fn set_version_aliases<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<i64>,
    {
        use std::iter::Iterator;
        self.version_aliases = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [annotations][crate::model::Secret::annotations].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// let x = Secret::new().set_annotations([
    ///     ("key0", "abc"),
    ///     ("key1", "xyz"),
    /// ]);
    /// ```
    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [version_destroy_ttl][crate::model::Secret::version_destroy_ttl].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use wkt::Duration;
    /// let x = Secret::new().set_version_destroy_ttl(Duration::default()/* use setters */);
    /// ```
    pub fn set_version_destroy_ttl<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.version_destroy_ttl = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [version_destroy_ttl][crate::model::Secret::version_destroy_ttl].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use wkt::Duration;
    /// let x = Secret::new().set_or_clear_version_destroy_ttl(Some(Duration::default()/* use setters */));
    /// let x = Secret::new().set_or_clear_version_destroy_ttl(None::<Duration>);
    /// ```
    pub fn set_or_clear_version_destroy_ttl<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.version_destroy_ttl = v.map(|x| x.into());
        self
    }

    /// Sets the value of [customer_managed_encryption][crate::model::Secret::customer_managed_encryption].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryption;
    /// let x = Secret::new().set_customer_managed_encryption(CustomerManagedEncryption::default()/* use setters */);
    /// ```
    pub fn set_customer_managed_encryption<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CustomerManagedEncryption>,
    {
        self.customer_managed_encryption = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [customer_managed_encryption][crate::model::Secret::customer_managed_encryption].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryption;
    /// let x = Secret::new().set_or_clear_customer_managed_encryption(Some(CustomerManagedEncryption::default()/* use setters */));
    /// let x = Secret::new().set_or_clear_customer_managed_encryption(None::<CustomerManagedEncryption>);
    /// ```
    pub fn set_or_clear_customer_managed_encryption<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CustomerManagedEncryption>,
    {
        self.customer_managed_encryption = v.map(|x| x.into());
        self
    }

    /// Sets the value of [tags][crate::model::Secret::tags].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// let x = Secret::new().set_tags([
    ///     ("key0", "abc"),
    ///     ("key1", "xyz"),
    /// ]);
    /// ```
    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [expiration][crate::model::Secret::expiration].
    ///
    /// Note that all the setters affecting `expiration` are mutually
    /// exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use google_cloud_secretmanager_v1::model::secret;
    /// use wkt::Timestamp;
    /// let x = Secret::new().set_expiration(Some(secret::Expiration::ExpireTime(Timestamp::default().into())));
    /// ```
    pub fn set_expiration<
        T: std::convert::Into<std::option::Option<crate::model::secret::Expiration>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.expiration = v.into();
        self
    }

    /// The value of [expiration][crate::model::Secret::expiration]
    /// if it holds a `ExpireTime`, `None` if the field is not set or
    /// holds a different branch.
    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
        #[allow(unreachable_patterns)]
        self.expiration.as_ref().and_then(|v| match v {
            crate::model::secret::Expiration::ExpireTime(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [expiration][crate::model::Secret::expiration]
    /// to hold a `ExpireTime`.
    ///
    /// Note that all the setters affecting `expiration` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use wkt::Timestamp;
    /// let x = Secret::new().set_expire_time(Timestamp::default()/* use setters */);
    /// assert!(x.expire_time().is_some());
    /// assert!(x.ttl().is_none());
    /// ```
    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
        mut self,
        v: T,
    ) -> Self {
        self.expiration =
            std::option::Option::Some(crate::model::secret::Expiration::ExpireTime(v.into()));
        self
    }

    /// The value of [expiration][crate::model::Secret::expiration]
    /// if it holds a `Ttl`, `None` if the field is not set or
    /// holds a different branch.
    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
        #[allow(unreachable_patterns)]
        self.expiration.as_ref().and_then(|v| match v {
            crate::model::secret::Expiration::Ttl(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [expiration][crate::model::Secret::expiration]
    /// to hold a `Ttl`.
    ///
    /// Note that all the setters affecting `expiration` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Secret;
    /// use wkt::Duration;
    /// let x = Secret::new().set_ttl(Duration::default()/* use setters */);
    /// assert!(x.ttl().is_some());
    /// assert!(x.expire_time().is_none());
    /// ```
    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
        self.expiration =
            std::option::Option::Some(crate::model::secret::Expiration::Ttl(v.into()));
        self
    }
}

impl wkt::message::Message for Secret {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.Secret"
    }
}

/// Defines additional types related to [Secret].
pub mod secret {
    #[allow(unused_imports)]
    use super::*;

    /// Expiration policy attached to the
    /// [Secret][google.cloud.secretmanager.v1.Secret]. If specified the
    /// [Secret][google.cloud.secretmanager.v1.Secret] and all
    /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be
    /// automatically deleted at expiration. Expired secrets are irreversibly
    /// deleted.
    ///
    /// Expiration is *not* the recommended way to set time-based permissions. [IAM
    /// Conditions](https://cloud.google.com/secret-manager/docs/access-control#conditions)
    /// is recommended for granting time-based permissions because the operation
    /// can be reversed.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Expiration {
        /// Optional. Timestamp in UTC when the
        /// [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire.
        /// This is always provided on output, regardless of what was sent on input.
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        ExpireTime(std::boxed::Box<wkt::Timestamp>),
        /// Input only. The TTL for the
        /// [Secret][google.cloud.secretmanager.v1.Secret].
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        Ttl(std::boxed::Box<wkt::Duration>),
    }
}

/// A secret version resource in the Secret Manager API.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretVersion {
    /// Output only. The resource name of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
    /// `projects/*/secrets/*/versions/*`.
    ///
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] IDs in a
    /// [Secret][google.cloud.secretmanager.v1.Secret] start at 1 and are
    /// incremented for each subsequent version of the secret.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub name: std::string::String,

    /// Output only. The time at which the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was created.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time this
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was destroyed.
    /// Only present if [state][google.cloud.secretmanager.v1.SecretVersion.state]
    /// is
    /// [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    /// [google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED]: crate::model::secret_version::State::Destroyed
    /// [google.cloud.secretmanager.v1.SecretVersion.state]: crate::model::SecretVersion::state
    pub destroy_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The current state of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub state: crate::model::secret_version::State,

    /// The replication status of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub replication_status: std::option::Option<crate::model::ReplicationStatus>,

    /// Output only. Etag of the currently stored
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub etag: std::string::String,

    /// Output only. True if payload checksum specified in
    /// [SecretPayload][google.cloud.secretmanager.v1.SecretPayload] object has
    /// been received by
    /// [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService]
    /// on
    /// [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretManagerService]: crate::client::SecretManagerService
    /// [google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]: crate::client::SecretManagerService::add_secret_version
    /// [google.cloud.secretmanager.v1.SecretPayload]: crate::model::SecretPayload
    pub client_specified_payload_checksum: bool,

    /// Optional. Output only. Scheduled destroy time for secret version.
    /// This is a part of the Delayed secret version destroy feature. For a
    /// Secret with a valid version destroy TTL, when a secert version is
    /// destroyed, version is moved to disabled state and it is scheduled for
    /// destruction Version is destroyed only after the scheduled_destroy_time.
    pub scheduled_destroy_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The customer-managed encryption status of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only
    /// populated if customer-managed encryption is used and
    /// [Secret][google.cloud.secretmanager.v1.Secret] is a regionalized secret.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub customer_managed_encryption:
        std::option::Option<crate::model::CustomerManagedEncryptionStatus>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SecretVersion {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SecretVersion::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// let x = SecretVersion::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::SecretVersion::create_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use wkt::Timestamp;
    /// let x = SecretVersion::new().set_create_time(Timestamp::default()/* use setters */);
    /// ```
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::SecretVersion::create_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use wkt::Timestamp;
    /// let x = SecretVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
    /// let x = SecretVersion::new().set_or_clear_create_time(None::<Timestamp>);
    /// ```
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [destroy_time][crate::model::SecretVersion::destroy_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use wkt::Timestamp;
    /// let x = SecretVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
    /// ```
    pub fn set_destroy_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.destroy_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [destroy_time][crate::model::SecretVersion::destroy_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use wkt::Timestamp;
    /// let x = SecretVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
    /// let x = SecretVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
    /// ```
    pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.destroy_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::SecretVersion::state].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use google_cloud_secretmanager_v1::model::secret_version::State;
    /// let x0 = SecretVersion::new().set_state(State::Enabled);
    /// let x1 = SecretVersion::new().set_state(State::Disabled);
    /// let x2 = SecretVersion::new().set_state(State::Destroyed);
    /// ```
    pub fn set_state<T: std::convert::Into<crate::model::secret_version::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [replication_status][crate::model::SecretVersion::replication_status].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use google_cloud_secretmanager_v1::model::ReplicationStatus;
    /// let x = SecretVersion::new().set_replication_status(ReplicationStatus::default()/* use setters */);
    /// ```
    pub fn set_replication_status<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ReplicationStatus>,
    {
        self.replication_status = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [replication_status][crate::model::SecretVersion::replication_status].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use google_cloud_secretmanager_v1::model::ReplicationStatus;
    /// let x = SecretVersion::new().set_or_clear_replication_status(Some(ReplicationStatus::default()/* use setters */));
    /// let x = SecretVersion::new().set_or_clear_replication_status(None::<ReplicationStatus>);
    /// ```
    pub fn set_or_clear_replication_status<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ReplicationStatus>,
    {
        self.replication_status = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::SecretVersion::etag].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// let x = SecretVersion::new().set_etag("example");
    /// ```
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [client_specified_payload_checksum][crate::model::SecretVersion::client_specified_payload_checksum].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// let x = SecretVersion::new().set_client_specified_payload_checksum(true);
    /// ```
    pub fn set_client_specified_payload_checksum<T: std::convert::Into<bool>>(
        mut self,
        v: T,
    ) -> Self {
        self.client_specified_payload_checksum = v.into();
        self
    }

    /// Sets the value of [scheduled_destroy_time][crate::model::SecretVersion::scheduled_destroy_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use wkt::Timestamp;
    /// let x = SecretVersion::new().set_scheduled_destroy_time(Timestamp::default()/* use setters */);
    /// ```
    pub fn set_scheduled_destroy_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.scheduled_destroy_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [scheduled_destroy_time][crate::model::SecretVersion::scheduled_destroy_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use wkt::Timestamp;
    /// let x = SecretVersion::new().set_or_clear_scheduled_destroy_time(Some(Timestamp::default()/* use setters */));
    /// let x = SecretVersion::new().set_or_clear_scheduled_destroy_time(None::<Timestamp>);
    /// ```
    pub fn set_or_clear_scheduled_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.scheduled_destroy_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [customer_managed_encryption][crate::model::SecretVersion::customer_managed_encryption].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryptionStatus;
    /// let x = SecretVersion::new().set_customer_managed_encryption(CustomerManagedEncryptionStatus::default()/* use setters */);
    /// ```
    pub fn set_customer_managed_encryption<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::CustomerManagedEncryptionStatus>,
    {
        self.customer_managed_encryption = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [customer_managed_encryption][crate::model::SecretVersion::customer_managed_encryption].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretVersion;
    /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryptionStatus;
    /// let x = SecretVersion::new().set_or_clear_customer_managed_encryption(Some(CustomerManagedEncryptionStatus::default()/* use setters */));
    /// let x = SecretVersion::new().set_or_clear_customer_managed_encryption(None::<CustomerManagedEncryptionStatus>);
    /// ```
    pub fn set_or_clear_customer_managed_encryption<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::CustomerManagedEncryptionStatus>,
    {
        self.customer_managed_encryption = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for SecretVersion {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.SecretVersion"
    }
}

/// Defines additional types related to [SecretVersion].
pub mod secret_version {
    #[allow(unused_imports)]
    use super::*;

    /// The state of a
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion], indicating if
    /// it can be accessed.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Not specified. This value is unused and invalid.
        Unspecified,
        /// The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may be
        /// accessed.
        ///
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        Enabled,
        /// The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may not
        /// be accessed, but the secret data is still available and can be placed
        /// back into the
        /// [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED]
        /// state.
        ///
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        /// [google.cloud.secretmanager.v1.SecretVersion.State.ENABLED]: crate::model::secret_version::State::Enabled
        Disabled,
        /// The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] is
        /// destroyed and the secret data is no longer stored. A version may not
        /// leave this state once entered.
        ///
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        Destroyed,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Enabled => std::option::Option::Some(1),
                Self::Disabled => std::option::Option::Some(2),
                Self::Destroyed => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Enabled => std::option::Option::Some("ENABLED"),
                Self::Disabled => std::option::Option::Some("DISABLED"),
                Self::Destroyed => std::option::Option::Some("DESTROYED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Enabled,
                2 => Self::Disabled,
                3 => Self::Destroyed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ENABLED" => Self::Enabled,
                "DISABLED" => Self::Disabled,
                "DESTROYED" => Self::Destroyed,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Enabled => serializer.serialize_i32(1),
                Self::Disabled => serializer.serialize_i32(2),
                Self::Destroyed => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.secretmanager.v1.SecretVersion.State",
            ))
        }
    }
}

/// A policy that defines the replication and encryption configuration of data.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Replication {
    /// The replication policy for this secret.
    pub replication: std::option::Option<crate::model::replication::Replication>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Replication {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [replication][crate::model::Replication::replication].
    ///
    /// Note that all the setters affecting `replication` are mutually
    /// exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Replication;
    /// use google_cloud_secretmanager_v1::model::replication;
    /// use google_cloud_secretmanager_v1::model::replication::Automatic;
    /// let x = Replication::new().set_replication(Some(replication::Replication::Automatic(Automatic::default().into())));
    /// ```
    pub fn set_replication<
        T: std::convert::Into<std::option::Option<crate::model::replication::Replication>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.replication = v.into();
        self
    }

    /// The value of [replication][crate::model::Replication::replication]
    /// if it holds a `Automatic`, `None` if the field is not set or
    /// holds a different branch.
    pub fn automatic(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::replication::Automatic>> {
        #[allow(unreachable_patterns)]
        self.replication.as_ref().and_then(|v| match v {
            crate::model::replication::Replication::Automatic(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [replication][crate::model::Replication::replication]
    /// to hold a `Automatic`.
    ///
    /// Note that all the setters affecting `replication` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Replication;
    /// use google_cloud_secretmanager_v1::model::replication::Automatic;
    /// let x = Replication::new().set_automatic(Automatic::default()/* use setters */);
    /// assert!(x.automatic().is_some());
    /// assert!(x.user_managed().is_none());
    /// ```
    pub fn set_automatic<
        T: std::convert::Into<std::boxed::Box<crate::model::replication::Automatic>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.replication =
            std::option::Option::Some(crate::model::replication::Replication::Automatic(v.into()));
        self
    }

    /// The value of [replication][crate::model::Replication::replication]
    /// if it holds a `UserManaged`, `None` if the field is not set or
    /// holds a different branch.
    pub fn user_managed(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::replication::UserManaged>> {
        #[allow(unreachable_patterns)]
        self.replication.as_ref().and_then(|v| match v {
            crate::model::replication::Replication::UserManaged(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [replication][crate::model::Replication::replication]
    /// to hold a `UserManaged`.
    ///
    /// Note that all the setters affecting `replication` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Replication;
    /// use google_cloud_secretmanager_v1::model::replication::UserManaged;
    /// let x = Replication::new().set_user_managed(UserManaged::default()/* use setters */);
    /// assert!(x.user_managed().is_some());
    /// assert!(x.automatic().is_none());
    /// ```
    pub fn set_user_managed<
        T: std::convert::Into<std::boxed::Box<crate::model::replication::UserManaged>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.replication = std::option::Option::Some(
            crate::model::replication::Replication::UserManaged(v.into()),
        );
        self
    }
}

impl wkt::message::Message for Replication {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.Replication"
    }
}

/// Defines additional types related to [Replication].
pub mod replication {
    #[allow(unused_imports)]
    use super::*;

    /// A replication policy that replicates the
    /// [Secret][google.cloud.secretmanager.v1.Secret] payload without any
    /// restrictions.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Automatic {
        /// Optional. The customer-managed encryption configuration of the
        /// [Secret][google.cloud.secretmanager.v1.Secret]. If no configuration is
        /// provided, Google-managed default encryption is used.
        ///
        /// Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption
        /// configuration only apply to
        /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added
        /// afterwards. They do not apply retroactively to existing
        /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        pub customer_managed_encryption:
            std::option::Option<crate::model::CustomerManagedEncryption>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Automatic {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [customer_managed_encryption][crate::model::replication::Automatic::customer_managed_encryption].
        ///
        /// # Example
        /// ```
        /// # use google_cloud_secretmanager_v1::model::replication::Automatic;
        /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryption;
        /// let x = Automatic::new().set_customer_managed_encryption(CustomerManagedEncryption::default()/* use setters */);
        /// ```
        pub fn set_customer_managed_encryption<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::CustomerManagedEncryption>,
        {
            self.customer_managed_encryption = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [customer_managed_encryption][crate::model::replication::Automatic::customer_managed_encryption].
        ///
        /// # Example
        /// ```
        /// # use google_cloud_secretmanager_v1::model::replication::Automatic;
        /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryption;
        /// let x = Automatic::new().set_or_clear_customer_managed_encryption(Some(CustomerManagedEncryption::default()/* use setters */));
        /// let x = Automatic::new().set_or_clear_customer_managed_encryption(None::<CustomerManagedEncryption>);
        /// ```
        pub fn set_or_clear_customer_managed_encryption<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<crate::model::CustomerManagedEncryption>,
        {
            self.customer_managed_encryption = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Automatic {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.secretmanager.v1.Replication.Automatic"
        }
    }

    /// A replication policy that replicates the
    /// [Secret][google.cloud.secretmanager.v1.Secret] payload into the locations
    /// specified in
    /// [Replication.UserManaged.replicas][google.cloud.secretmanager.v1.Replication.UserManaged.replicas]
    ///
    /// [google.cloud.secretmanager.v1.Replication.UserManaged.replicas]: crate::model::replication::UserManaged::replicas
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct UserManaged {
        /// Required. The list of Replicas for this
        /// [Secret][google.cloud.secretmanager.v1.Secret].
        ///
        /// Cannot be empty.
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        pub replicas: std::vec::Vec<crate::model::replication::user_managed::Replica>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl UserManaged {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [replicas][crate::model::replication::UserManaged::replicas].
        ///
        /// # Example
        /// ```
        /// # use google_cloud_secretmanager_v1::model::replication::UserManaged;
        /// use google_cloud_secretmanager_v1::model::replication::user_managed::Replica;
        /// let x = UserManaged::new()
        ///     .set_replicas([
        ///         Replica::default()/* use setters */,
        ///         Replica::default()/* use (different) setters */,
        ///     ]);
        /// ```
        pub fn set_replicas<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::replication::user_managed::Replica>,
        {
            use std::iter::Iterator;
            self.replicas = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for UserManaged {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.secretmanager.v1.Replication.UserManaged"
        }
    }

    /// Defines additional types related to [UserManaged].
    pub mod user_managed {
        #[allow(unused_imports)]
        use super::*;

        /// Represents a Replica for this
        /// [Secret][google.cloud.secretmanager.v1.Secret].
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Replica {
            /// The canonical IDs of the location to replicate data.
            /// For example: `"us-east1"`.
            pub location: std::string::String,

            /// Optional. The customer-managed encryption configuration of the
            /// [User-Managed Replica][Replication.UserManaged.Replica]. If no
            /// configuration is provided, Google-managed default encryption is used.
            ///
            /// Updates to the [Secret][google.cloud.secretmanager.v1.Secret]
            /// encryption configuration only apply to
            /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added
            /// afterwards. They do not apply retroactively to existing
            /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
            ///
            /// [Replication.UserManaged.Replica]: crate::model::replication::user_managed::Replica
            /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
            /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
            pub customer_managed_encryption:
                std::option::Option<crate::model::CustomerManagedEncryption>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Replica {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [location][crate::model::replication::user_managed::Replica::location].
            ///
            /// # Example
            /// ```
            /// # use google_cloud_secretmanager_v1::model::replication::user_managed::Replica;
            /// let x = Replica::new().set_location("example");
            /// ```
            pub fn set_location<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.location = v.into();
                self
            }

            /// Sets the value of [customer_managed_encryption][crate::model::replication::user_managed::Replica::customer_managed_encryption].
            ///
            /// # Example
            /// ```
            /// # use google_cloud_secretmanager_v1::model::replication::user_managed::Replica;
            /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryption;
            /// let x = Replica::new().set_customer_managed_encryption(CustomerManagedEncryption::default()/* use setters */);
            /// ```
            pub fn set_customer_managed_encryption<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::CustomerManagedEncryption>,
            {
                self.customer_managed_encryption = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [customer_managed_encryption][crate::model::replication::user_managed::Replica::customer_managed_encryption].
            ///
            /// # Example
            /// ```
            /// # use google_cloud_secretmanager_v1::model::replication::user_managed::Replica;
            /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryption;
            /// let x = Replica::new().set_or_clear_customer_managed_encryption(Some(CustomerManagedEncryption::default()/* use setters */));
            /// let x = Replica::new().set_or_clear_customer_managed_encryption(None::<CustomerManagedEncryption>);
            /// ```
            pub fn set_or_clear_customer_managed_encryption<T>(
                mut self,
                v: std::option::Option<T>,
            ) -> Self
            where
                T: std::convert::Into<crate::model::CustomerManagedEncryption>,
            {
                self.customer_managed_encryption = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Replica {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.secretmanager.v1.Replication.UserManaged.Replica"
            }
        }
    }

    /// The replication policy for this secret.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Replication {
        /// The [Secret][google.cloud.secretmanager.v1.Secret] will automatically be
        /// replicated without any restrictions.
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        Automatic(std::boxed::Box<crate::model::replication::Automatic>),
        /// The [Secret][google.cloud.secretmanager.v1.Secret] will only be
        /// replicated into the locations specified.
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        UserManaged(std::boxed::Box<crate::model::replication::UserManaged>),
    }
}

/// Configuration for encrypting secret payloads using customer-managed
/// encryption keys (CMEK).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CustomerManagedEncryption {
    /// Required. The resource name of the Cloud KMS CryptoKey used to encrypt
    /// secret payloads.
    ///
    /// For secrets using the
    /// [UserManaged][google.cloud.secretmanager.v1.Replication.UserManaged]
    /// replication policy type, Cloud KMS CryptoKeys must reside in the same
    /// location as the [replica location][Secret.UserManaged.Replica.location].
    ///
    /// For secrets using the
    /// [Automatic][google.cloud.secretmanager.v1.Replication.Automatic]
    /// replication policy type, Cloud KMS CryptoKeys must reside in `global`.
    ///
    /// The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    ///
    /// [google.cloud.secretmanager.v1.Replication.Automatic]: crate::model::replication::Automatic
    /// [google.cloud.secretmanager.v1.Replication.UserManaged]: crate::model::replication::UserManaged
    pub kms_key_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CustomerManagedEncryption {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [kms_key_name][crate::model::CustomerManagedEncryption::kms_key_name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::CustomerManagedEncryption;
    /// let x = CustomerManagedEncryption::new().set_kms_key_name("example");
    /// ```
    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.kms_key_name = v.into();
        self
    }
}

impl wkt::message::Message for CustomerManagedEncryption {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.CustomerManagedEncryption"
    }
}

/// The replication status of a
/// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReplicationStatus {
    /// The replication status of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub replication_status:
        std::option::Option<crate::model::replication_status::ReplicationStatus>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReplicationStatus {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [replication_status][crate::model::ReplicationStatus::replication_status].
    ///
    /// Note that all the setters affecting `replication_status` are mutually
    /// exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ReplicationStatus;
    /// use google_cloud_secretmanager_v1::model::replication_status;
    /// use google_cloud_secretmanager_v1::model::replication_status::AutomaticStatus;
    /// let x = ReplicationStatus::new().set_replication_status(Some(replication_status::ReplicationStatus::Automatic(AutomaticStatus::default().into())));
    /// ```
    pub fn set_replication_status<
        T: std::convert::Into<
                std::option::Option<crate::model::replication_status::ReplicationStatus>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.replication_status = v.into();
        self
    }

    /// The value of [replication_status][crate::model::ReplicationStatus::replication_status]
    /// if it holds a `Automatic`, `None` if the field is not set or
    /// holds a different branch.
    pub fn automatic(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::replication_status::AutomaticStatus>>
    {
        #[allow(unreachable_patterns)]
        self.replication_status.as_ref().and_then(|v| match v {
            crate::model::replication_status::ReplicationStatus::Automatic(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [replication_status][crate::model::ReplicationStatus::replication_status]
    /// to hold a `Automatic`.
    ///
    /// Note that all the setters affecting `replication_status` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ReplicationStatus;
    /// use google_cloud_secretmanager_v1::model::replication_status::AutomaticStatus;
    /// let x = ReplicationStatus::new().set_automatic(AutomaticStatus::default()/* use setters */);
    /// assert!(x.automatic().is_some());
    /// assert!(x.user_managed().is_none());
    /// ```
    pub fn set_automatic<
        T: std::convert::Into<std::boxed::Box<crate::model::replication_status::AutomaticStatus>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.replication_status = std::option::Option::Some(
            crate::model::replication_status::ReplicationStatus::Automatic(v.into()),
        );
        self
    }

    /// The value of [replication_status][crate::model::ReplicationStatus::replication_status]
    /// if it holds a `UserManaged`, `None` if the field is not set or
    /// holds a different branch.
    pub fn user_managed(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::replication_status::UserManagedStatus>>
    {
        #[allow(unreachable_patterns)]
        self.replication_status.as_ref().and_then(|v| match v {
            crate::model::replication_status::ReplicationStatus::UserManaged(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [replication_status][crate::model::ReplicationStatus::replication_status]
    /// to hold a `UserManaged`.
    ///
    /// Note that all the setters affecting `replication_status` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ReplicationStatus;
    /// use google_cloud_secretmanager_v1::model::replication_status::UserManagedStatus;
    /// let x = ReplicationStatus::new().set_user_managed(UserManagedStatus::default()/* use setters */);
    /// assert!(x.user_managed().is_some());
    /// assert!(x.automatic().is_none());
    /// ```
    pub fn set_user_managed<
        T: std::convert::Into<std::boxed::Box<crate::model::replication_status::UserManagedStatus>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.replication_status = std::option::Option::Some(
            crate::model::replication_status::ReplicationStatus::UserManaged(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ReplicationStatus {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.ReplicationStatus"
    }
}

/// Defines additional types related to [ReplicationStatus].
pub mod replication_status {
    #[allow(unused_imports)]
    use super::*;

    /// The replication status of a
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using
    /// automatic replication.
    ///
    /// Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret]
    /// has an automatic replication policy.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct AutomaticStatus {
        /// Output only. The customer-managed encryption status of the
        /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only
        /// populated if customer-managed encryption is used.
        ///
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        pub customer_managed_encryption:
            std::option::Option<crate::model::CustomerManagedEncryptionStatus>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl AutomaticStatus {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [customer_managed_encryption][crate::model::replication_status::AutomaticStatus::customer_managed_encryption].
        ///
        /// # Example
        /// ```
        /// # use google_cloud_secretmanager_v1::model::replication_status::AutomaticStatus;
        /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryptionStatus;
        /// let x = AutomaticStatus::new().set_customer_managed_encryption(CustomerManagedEncryptionStatus::default()/* use setters */);
        /// ```
        pub fn set_customer_managed_encryption<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::CustomerManagedEncryptionStatus>,
        {
            self.customer_managed_encryption = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [customer_managed_encryption][crate::model::replication_status::AutomaticStatus::customer_managed_encryption].
        ///
        /// # Example
        /// ```
        /// # use google_cloud_secretmanager_v1::model::replication_status::AutomaticStatus;
        /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryptionStatus;
        /// let x = AutomaticStatus::new().set_or_clear_customer_managed_encryption(Some(CustomerManagedEncryptionStatus::default()/* use setters */));
        /// let x = AutomaticStatus::new().set_or_clear_customer_managed_encryption(None::<CustomerManagedEncryptionStatus>);
        /// ```
        pub fn set_or_clear_customer_managed_encryption<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<crate::model::CustomerManagedEncryptionStatus>,
        {
            self.customer_managed_encryption = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for AutomaticStatus {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.secretmanager.v1.ReplicationStatus.AutomaticStatus"
        }
    }

    /// The replication status of a
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using
    /// user-managed replication.
    ///
    /// Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret]
    /// has a user-managed replication policy.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct UserManagedStatus {
        /// Output only. The list of replica statuses for the
        /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
        ///
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        pub replicas:
            std::vec::Vec<crate::model::replication_status::user_managed_status::ReplicaStatus>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl UserManagedStatus {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [replicas][crate::model::replication_status::UserManagedStatus::replicas].
        ///
        /// # Example
        /// ```
        /// # use google_cloud_secretmanager_v1::model::replication_status::UserManagedStatus;
        /// use google_cloud_secretmanager_v1::model::replication_status::user_managed_status::ReplicaStatus;
        /// let x = UserManagedStatus::new()
        ///     .set_replicas([
        ///         ReplicaStatus::default()/* use setters */,
        ///         ReplicaStatus::default()/* use (different) setters */,
        ///     ]);
        /// ```
        pub fn set_replicas<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<
                    crate::model::replication_status::user_managed_status::ReplicaStatus,
                >,
        {
            use std::iter::Iterator;
            self.replicas = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for UserManagedStatus {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.secretmanager.v1.ReplicationStatus.UserManagedStatus"
        }
    }

    /// Defines additional types related to [UserManagedStatus].
    pub mod user_managed_status {
        #[allow(unused_imports)]
        use super::*;

        /// Describes the status of a user-managed replica for the
        /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
        ///
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct ReplicaStatus {
            /// Output only. The canonical ID of the replica location.
            /// For example: `"us-east1"`.
            pub location: std::string::String,

            /// Output only. The customer-managed encryption status of the
            /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only
            /// populated if customer-managed encryption is used.
            ///
            /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
            pub customer_managed_encryption:
                std::option::Option<crate::model::CustomerManagedEncryptionStatus>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl ReplicaStatus {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [location][crate::model::replication_status::user_managed_status::ReplicaStatus::location].
            ///
            /// # Example
            /// ```
            /// # use google_cloud_secretmanager_v1::model::replication_status::user_managed_status::ReplicaStatus;
            /// let x = ReplicaStatus::new().set_location("example");
            /// ```
            pub fn set_location<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.location = v.into();
                self
            }

            /// Sets the value of [customer_managed_encryption][crate::model::replication_status::user_managed_status::ReplicaStatus::customer_managed_encryption].
            ///
            /// # Example
            /// ```
            /// # use google_cloud_secretmanager_v1::model::replication_status::user_managed_status::ReplicaStatus;
            /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryptionStatus;
            /// let x = ReplicaStatus::new().set_customer_managed_encryption(CustomerManagedEncryptionStatus::default()/* use setters */);
            /// ```
            pub fn set_customer_managed_encryption<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::CustomerManagedEncryptionStatus>,
            {
                self.customer_managed_encryption = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [customer_managed_encryption][crate::model::replication_status::user_managed_status::ReplicaStatus::customer_managed_encryption].
            ///
            /// # Example
            /// ```
            /// # use google_cloud_secretmanager_v1::model::replication_status::user_managed_status::ReplicaStatus;
            /// use google_cloud_secretmanager_v1::model::CustomerManagedEncryptionStatus;
            /// let x = ReplicaStatus::new().set_or_clear_customer_managed_encryption(Some(CustomerManagedEncryptionStatus::default()/* use setters */));
            /// let x = ReplicaStatus::new().set_or_clear_customer_managed_encryption(None::<CustomerManagedEncryptionStatus>);
            /// ```
            pub fn set_or_clear_customer_managed_encryption<T>(
                mut self,
                v: std::option::Option<T>,
            ) -> Self
            where
                T: std::convert::Into<crate::model::CustomerManagedEncryptionStatus>,
            {
                self.customer_managed_encryption = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for ReplicaStatus {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.secretmanager.v1.ReplicationStatus.UserManagedStatus.ReplicaStatus"
            }
        }
    }

    /// The replication status of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ReplicationStatus {
        /// Describes the replication status of a
        /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with
        /// automatic replication.
        ///
        /// Only populated if the parent
        /// [Secret][google.cloud.secretmanager.v1.Secret] has an automatic
        /// replication policy.
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        Automatic(std::boxed::Box<crate::model::replication_status::AutomaticStatus>),
        /// Describes the replication status of a
        /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with
        /// user-managed replication.
        ///
        /// Only populated if the parent
        /// [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed
        /// replication policy.
        ///
        /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
        /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
        UserManaged(std::boxed::Box<crate::model::replication_status::UserManagedStatus>),
    }
}

/// Describes the status of customer-managed encryption.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CustomerManagedEncryptionStatus {
    /// Required. The resource name of the Cloud KMS CryptoKeyVersion used to
    /// encrypt the secret payload, in the following format:
    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/versions/*`.
    pub kms_key_version_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CustomerManagedEncryptionStatus {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [kms_key_version_name][crate::model::CustomerManagedEncryptionStatus::kms_key_version_name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::CustomerManagedEncryptionStatus;
    /// let x = CustomerManagedEncryptionStatus::new().set_kms_key_version_name("example");
    /// ```
    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.kms_key_version_name = v.into();
        self
    }
}

impl wkt::message::Message for CustomerManagedEncryptionStatus {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.CustomerManagedEncryptionStatus"
    }
}

/// A Pub/Sub topic which Secret Manager will publish to when control plane
/// events occur on this secret.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Topic {
    /// Identifier. The resource name of the Pub/Sub topic that will be published
    /// to, in the following format: `projects/*/topics/*`. For publication to
    /// succeed, the Secret Manager service agent must have the
    /// `pubsub.topic.publish` permission on the topic. The Pub/Sub Publisher role
    /// (`roles/pubsub.publisher`) includes this permission.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Topic {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Topic::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Topic;
    /// let x = Topic::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for Topic {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.Topic"
    }
}

/// The rotation time and period for a
/// [Secret][google.cloud.secretmanager.v1.Secret]. At next_rotation_time, Secret
/// Manager will send a Pub/Sub notification to the topics configured on the
/// Secret. [Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be
/// set to configure rotation.
///
/// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
/// [google.cloud.secretmanager.v1.Secret.topics]: crate::model::Secret::topics
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Rotation {
    /// Optional. Timestamp in UTC at which the
    /// [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to rotate.
    /// Cannot be set to less than 300s (5 min) in the future and at most
    /// 3153600000s (100 years).
    ///
    /// [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time]
    /// MUST  be set if
    /// [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period]
    /// is set.
    ///
    /// [google.cloud.secretmanager.v1.Rotation.next_rotation_time]: crate::model::Rotation::next_rotation_time
    /// [google.cloud.secretmanager.v1.Rotation.rotation_period]: crate::model::Rotation::rotation_period
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub next_rotation_time: std::option::Option<wkt::Timestamp>,

    /// Input only. The Duration between rotation notifications. Must be in seconds
    /// and at least 3600s (1h) and at most 3153600000s (100 years).
    ///
    /// If
    /// [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period]
    /// is set,
    /// [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time]
    /// must be set.
    /// [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time]
    /// will be advanced by this period when the service automatically sends
    /// rotation notifications.
    ///
    /// [google.cloud.secretmanager.v1.Rotation.next_rotation_time]: crate::model::Rotation::next_rotation_time
    /// [google.cloud.secretmanager.v1.Rotation.rotation_period]: crate::model::Rotation::rotation_period
    pub rotation_period: std::option::Option<wkt::Duration>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Rotation {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [next_rotation_time][crate::model::Rotation::next_rotation_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Rotation;
    /// use wkt::Timestamp;
    /// let x = Rotation::new().set_next_rotation_time(Timestamp::default()/* use setters */);
    /// ```
    pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.next_rotation_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [next_rotation_time][crate::model::Rotation::next_rotation_time].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Rotation;
    /// use wkt::Timestamp;
    /// let x = Rotation::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
    /// let x = Rotation::new().set_or_clear_next_rotation_time(None::<Timestamp>);
    /// ```
    pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.next_rotation_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [rotation_period][crate::model::Rotation::rotation_period].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Rotation;
    /// use wkt::Duration;
    /// let x = Rotation::new().set_rotation_period(Duration::default()/* use setters */);
    /// ```
    pub fn set_rotation_period<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.rotation_period = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rotation_period][crate::model::Rotation::rotation_period].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::Rotation;
    /// use wkt::Duration;
    /// let x = Rotation::new().set_or_clear_rotation_period(Some(Duration::default()/* use setters */));
    /// let x = Rotation::new().set_or_clear_rotation_period(None::<Duration>);
    /// ```
    pub fn set_or_clear_rotation_period<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.rotation_period = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Rotation {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.Rotation"
    }
}

/// A secret payload resource in the Secret Manager API. This contains the
/// sensitive secret payload that is associated with a
/// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretPayload {
    /// The secret data. Must be no larger than 64KiB.
    pub data: ::bytes::Bytes,

    /// Optional. If specified,
    /// [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService]
    /// will verify the integrity of the received
    /// [data][google.cloud.secretmanager.v1.SecretPayload.data] on
    /// [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]
    /// calls using the crc32c checksum and store it to include in future
    /// [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]
    /// responses. If a checksum is not provided in the
    /// [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]
    /// request, the
    /// [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService]
    /// will generate and store one for you.
    ///
    /// The CRC32C value is encoded as a Int64 for compatibility, and can be
    /// safely downconverted to uint32 in languages that support this type.
    /// <https://cloud.google.com/apis/design/design_patterns#integer_types>
    ///
    /// [google.cloud.secretmanager.v1.SecretManagerService]: crate::client::SecretManagerService
    /// [google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]: crate::client::SecretManagerService::access_secret_version
    /// [google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]: crate::client::SecretManagerService::add_secret_version
    /// [google.cloud.secretmanager.v1.SecretPayload.data]: crate::model::SecretPayload::data
    pub data_crc32c: std::option::Option<i64>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SecretPayload {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data][crate::model::SecretPayload::data].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretPayload;
    /// let x = SecretPayload::new().set_data(bytes::Bytes::from_static(b"example"));
    /// ```
    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.data = v.into();
        self
    }

    /// Sets the value of [data_crc32c][crate::model::SecretPayload::data_crc32c].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretPayload;
    /// let x = SecretPayload::new().set_data_crc32c(42);
    /// ```
    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<i64>,
    {
        self.data_crc32c = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [data_crc32c][crate::model::SecretPayload::data_crc32c].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::SecretPayload;
    /// let x = SecretPayload::new().set_or_clear_data_crc32c(Some(42));
    /// let x = SecretPayload::new().set_or_clear_data_crc32c(None::<i32>);
    /// ```
    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<i64>,
    {
        self.data_crc32c = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for SecretPayload {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.SecretPayload"
    }
}

/// Request message for
/// [SecretManagerService.ListSecrets][google.cloud.secretmanager.v1.SecretManagerService.ListSecrets].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.ListSecrets]: crate::client::SecretManagerService::list_secrets
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSecretsRequest {
    /// Required. The resource name of the project associated with the
    /// [Secrets][google.cloud.secretmanager.v1.Secret], in the format `projects/*`
    /// or `projects/*/locations/*`
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub parent: std::string::String,

    /// Optional. The maximum number of results to be returned in a single page. If
    /// set to 0, the server decides the number of results to return. If the
    /// number is greater than 25000, it is capped at 25000.
    pub page_size: i32,

    /// Optional. Pagination token, returned earlier via
    /// [ListSecretsResponse.next_page_token][google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token].
    ///
    /// [google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token]: crate::model::ListSecretsResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Filter string, adhering to the rules in
    /// [List-operation
    /// filtering](https://cloud.google.com/secret-manager/docs/filtering). List
    /// only secrets matching the filter. If filter is empty, all secrets are
    /// listed.
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSecretsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListSecretsRequest::parent].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretsRequest;
    /// let x = ListSecretsRequest::new().set_parent("example");
    /// ```
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListSecretsRequest::page_size].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretsRequest;
    /// let x = ListSecretsRequest::new().set_page_size(42);
    /// ```
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListSecretsRequest::page_token].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretsRequest;
    /// let x = ListSecretsRequest::new().set_page_token("example");
    /// ```
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListSecretsRequest::filter].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretsRequest;
    /// let x = ListSecretsRequest::new().set_filter("example");
    /// ```
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListSecretsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.ListSecretsRequest"
    }
}

/// Response message for
/// [SecretManagerService.ListSecrets][google.cloud.secretmanager.v1.SecretManagerService.ListSecrets].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.ListSecrets]: crate::client::SecretManagerService::list_secrets
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSecretsResponse {
    /// The list of [Secrets][google.cloud.secretmanager.v1.Secret] sorted in
    /// reverse by create_time (newest first).
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub secrets: std::vec::Vec<crate::model::Secret>,

    /// A token to retrieve the next page of results. Pass this value in
    /// [ListSecretsRequest.page_token][google.cloud.secretmanager.v1.ListSecretsRequest.page_token]
    /// to retrieve the next page.
    ///
    /// [google.cloud.secretmanager.v1.ListSecretsRequest.page_token]: crate::model::ListSecretsRequest::page_token
    pub next_page_token: std::string::String,

    /// The total number of [Secrets][google.cloud.secretmanager.v1.Secret] but 0
    /// when the
    /// [ListSecretsRequest.filter][google.cloud.secretmanager.v1.ListSecretsRequest.filter]
    /// field is set.
    ///
    /// [google.cloud.secretmanager.v1.ListSecretsRequest.filter]: crate::model::ListSecretsRequest::filter
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub total_size: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSecretsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [secrets][crate::model::ListSecretsResponse::secrets].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretsResponse;
    /// use google_cloud_secretmanager_v1::model::Secret;
    /// let x = ListSecretsResponse::new()
    ///     .set_secrets([
    ///         Secret::default()/* use setters */,
    ///         Secret::default()/* use (different) setters */,
    ///     ]);
    /// ```
    pub fn set_secrets<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Secret>,
    {
        use std::iter::Iterator;
        self.secrets = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListSecretsResponse::next_page_token].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretsResponse;
    /// let x = ListSecretsResponse::new().set_next_page_token("example");
    /// ```
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [total_size][crate::model::ListSecretsResponse::total_size].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretsResponse;
    /// let x = ListSecretsResponse::new().set_total_size(42);
    /// ```
    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.total_size = v.into();
        self
    }
}

impl wkt::message::Message for ListSecretsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.ListSecretsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListSecretsResponse {
    type PageItem = crate::model::Secret;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.secrets
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for
/// [SecretManagerService.CreateSecret][google.cloud.secretmanager.v1.SecretManagerService.CreateSecret].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.CreateSecret]: crate::client::SecretManagerService::create_secret
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateSecretRequest {
    /// Required. The resource name of the project to associate with the
    /// [Secret][google.cloud.secretmanager.v1.Secret], in the format `projects/*`
    /// or `projects/*/locations/*`.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub parent: std::string::String,

    /// Required. This must be unique within the project.
    ///
    /// A secret ID is a string with a maximum length of 255 characters and can
    /// contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and
    /// underscore (`_`) characters.
    pub secret_id: std::string::String,

    /// Required. A [Secret][google.cloud.secretmanager.v1.Secret] with initial
    /// field values.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub secret: std::option::Option<crate::model::Secret>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateSecretRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateSecretRequest::parent].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::CreateSecretRequest;
    /// let x = CreateSecretRequest::new().set_parent("example");
    /// ```
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [secret_id][crate::model::CreateSecretRequest::secret_id].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::CreateSecretRequest;
    /// let x = CreateSecretRequest::new().set_secret_id("example");
    /// ```
    pub fn set_secret_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.secret_id = v.into();
        self
    }

    /// Sets the value of [secret][crate::model::CreateSecretRequest::secret].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::CreateSecretRequest;
    /// use google_cloud_secretmanager_v1::model::Secret;
    /// let x = CreateSecretRequest::new().set_secret(Secret::default()/* use setters */);
    /// ```
    pub fn set_secret<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Secret>,
    {
        self.secret = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [secret][crate::model::CreateSecretRequest::secret].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::CreateSecretRequest;
    /// use google_cloud_secretmanager_v1::model::Secret;
    /// let x = CreateSecretRequest::new().set_or_clear_secret(Some(Secret::default()/* use setters */));
    /// let x = CreateSecretRequest::new().set_or_clear_secret(None::<Secret>);
    /// ```
    pub fn set_or_clear_secret<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Secret>,
    {
        self.secret = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateSecretRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.CreateSecretRequest"
    }
}

/// Request message for
/// [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]: crate::client::SecretManagerService::add_secret_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddSecretVersionRequest {
    /// Required. The resource name of the
    /// [Secret][google.cloud.secretmanager.v1.Secret] to associate with the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
    /// `projects/*/secrets/*` or `projects/*/locations/*/secrets/*`.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub parent: std::string::String,

    /// Required. The secret payload of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub payload: std::option::Option<crate::model::SecretPayload>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AddSecretVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::AddSecretVersionRequest::parent].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::AddSecretVersionRequest;
    /// let x = AddSecretVersionRequest::new().set_parent("example");
    /// ```
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [payload][crate::model::AddSecretVersionRequest::payload].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::AddSecretVersionRequest;
    /// use google_cloud_secretmanager_v1::model::SecretPayload;
    /// let x = AddSecretVersionRequest::new().set_payload(SecretPayload::default()/* use setters */);
    /// ```
    pub fn set_payload<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::SecretPayload>,
    {
        self.payload = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [payload][crate::model::AddSecretVersionRequest::payload].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::AddSecretVersionRequest;
    /// use google_cloud_secretmanager_v1::model::SecretPayload;
    /// let x = AddSecretVersionRequest::new().set_or_clear_payload(Some(SecretPayload::default()/* use setters */));
    /// let x = AddSecretVersionRequest::new().set_or_clear_payload(None::<SecretPayload>);
    /// ```
    pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::SecretPayload>,
    {
        self.payload = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for AddSecretVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.AddSecretVersionRequest"
    }
}

/// Request message for
/// [SecretManagerService.GetSecret][google.cloud.secretmanager.v1.SecretManagerService.GetSecret].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.GetSecret]: crate::client::SecretManagerService::get_secret
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSecretRequest {
    /// Required. The resource name of the
    /// [Secret][google.cloud.secretmanager.v1.Secret], in the format
    /// `projects/*/secrets/*` or `projects/*/locations/*/secrets/*`.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetSecretRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetSecretRequest::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::GetSecretRequest;
    /// let x = GetSecretRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetSecretRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.GetSecretRequest"
    }
}

/// Request message for
/// [SecretManagerService.ListSecretVersions][google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions]: crate::client::SecretManagerService::list_secret_versions
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSecretVersionsRequest {
    /// Required. The resource name of the
    /// [Secret][google.cloud.secretmanager.v1.Secret] associated with the
    /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] to list, in
    /// the format `projects/*/secrets/*` or `projects/*/locations/*/secrets/*`.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub parent: std::string::String,

    /// Optional. The maximum number of results to be returned in a single page. If
    /// set to 0, the server decides the number of results to return. If the
    /// number is greater than 25000, it is capped at 25000.
    pub page_size: i32,

    /// Optional. Pagination token, returned earlier via
    /// ListSecretVersionsResponse.next_page_token][].
    pub page_token: std::string::String,

    /// Optional. Filter string, adhering to the rules in
    /// [List-operation
    /// filtering](https://cloud.google.com/secret-manager/docs/filtering). List
    /// only secret versions matching the filter. If filter is empty, all secret
    /// versions are listed.
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSecretVersionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListSecretVersionsRequest::parent].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretVersionsRequest;
    /// let x = ListSecretVersionsRequest::new().set_parent("example");
    /// ```
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListSecretVersionsRequest::page_size].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretVersionsRequest;
    /// let x = ListSecretVersionsRequest::new().set_page_size(42);
    /// ```
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListSecretVersionsRequest::page_token].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretVersionsRequest;
    /// let x = ListSecretVersionsRequest::new().set_page_token("example");
    /// ```
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListSecretVersionsRequest::filter].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretVersionsRequest;
    /// let x = ListSecretVersionsRequest::new().set_filter("example");
    /// ```
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListSecretVersionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.ListSecretVersionsRequest"
    }
}

/// Response message for
/// [SecretManagerService.ListSecretVersions][google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions]: crate::client::SecretManagerService::list_secret_versions
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSecretVersionsResponse {
    /// The list of [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]
    /// sorted in reverse by create_time (newest first).
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub versions: std::vec::Vec<crate::model::SecretVersion>,

    /// A token to retrieve the next page of results. Pass this value in
    /// [ListSecretVersionsRequest.page_token][google.cloud.secretmanager.v1.ListSecretVersionsRequest.page_token]
    /// to retrieve the next page.
    ///
    /// [google.cloud.secretmanager.v1.ListSecretVersionsRequest.page_token]: crate::model::ListSecretVersionsRequest::page_token
    pub next_page_token: std::string::String,

    /// The total number of
    /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] but 0 when
    /// the
    /// [ListSecretsRequest.filter][google.cloud.secretmanager.v1.ListSecretsRequest.filter]
    /// field is set.
    ///
    /// [google.cloud.secretmanager.v1.ListSecretsRequest.filter]: crate::model::ListSecretsRequest::filter
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub total_size: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSecretVersionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [versions][crate::model::ListSecretVersionsResponse::versions].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretVersionsResponse;
    /// use google_cloud_secretmanager_v1::model::SecretVersion;
    /// let x = ListSecretVersionsResponse::new()
    ///     .set_versions([
    ///         SecretVersion::default()/* use setters */,
    ///         SecretVersion::default()/* use (different) setters */,
    ///     ]);
    /// ```
    pub fn set_versions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::SecretVersion>,
    {
        use std::iter::Iterator;
        self.versions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListSecretVersionsResponse::next_page_token].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretVersionsResponse;
    /// let x = ListSecretVersionsResponse::new().set_next_page_token("example");
    /// ```
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [total_size][crate::model::ListSecretVersionsResponse::total_size].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::ListSecretVersionsResponse;
    /// let x = ListSecretVersionsResponse::new().set_total_size(42);
    /// ```
    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.total_size = v.into();
        self
    }
}

impl wkt::message::Message for ListSecretVersionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.ListSecretVersionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListSecretVersionsResponse {
    type PageItem = crate::model::SecretVersion;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.versions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for
/// [SecretManagerService.GetSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion]: crate::client::SecretManagerService::get_secret_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSecretVersionRequest {
    /// Required. The resource name of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
    /// `projects/*/secrets/*/versions/*` or
    /// `projects/*/locations/*/secrets/*/versions/*`.
    ///
    /// `projects/*/secrets/*/versions/latest` or
    /// `projects/*/locations/*/secrets/*/versions/latest` is an alias to the most
    /// recently created
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetSecretVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetSecretVersionRequest::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::GetSecretVersionRequest;
    /// let x = GetSecretVersionRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetSecretVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.GetSecretVersionRequest"
    }
}

/// Request message for
/// [SecretManagerService.UpdateSecret][google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret]: crate::client::SecretManagerService::update_secret
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateSecretRequest {
    /// Required. [Secret][google.cloud.secretmanager.v1.Secret] with updated field
    /// values.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub secret: std::option::Option<crate::model::Secret>,

    /// Required. Specifies the fields to be updated.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateSecretRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [secret][crate::model::UpdateSecretRequest::secret].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::UpdateSecretRequest;
    /// use google_cloud_secretmanager_v1::model::Secret;
    /// let x = UpdateSecretRequest::new().set_secret(Secret::default()/* use setters */);
    /// ```
    pub fn set_secret<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Secret>,
    {
        self.secret = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [secret][crate::model::UpdateSecretRequest::secret].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::UpdateSecretRequest;
    /// use google_cloud_secretmanager_v1::model::Secret;
    /// let x = UpdateSecretRequest::new().set_or_clear_secret(Some(Secret::default()/* use setters */));
    /// let x = UpdateSecretRequest::new().set_or_clear_secret(None::<Secret>);
    /// ```
    pub fn set_or_clear_secret<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Secret>,
    {
        self.secret = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateSecretRequest::update_mask].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::UpdateSecretRequest;
    /// use wkt::FieldMask;
    /// let x = UpdateSecretRequest::new().set_update_mask(FieldMask::default()/* use setters */);
    /// ```
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateSecretRequest::update_mask].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::UpdateSecretRequest;
    /// use wkt::FieldMask;
    /// let x = UpdateSecretRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
    /// let x = UpdateSecretRequest::new().set_or_clear_update_mask(None::<FieldMask>);
    /// ```
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateSecretRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.UpdateSecretRequest"
    }
}

/// Request message for
/// [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]: crate::client::SecretManagerService::access_secret_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessSecretVersionRequest {
    /// Required. The resource name of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
    /// `projects/*/secrets/*/versions/*` or
    /// `projects/*/locations/*/secrets/*/versions/*`.
    ///
    /// `projects/*/secrets/*/versions/latest` or
    /// `projects/*/locations/*/secrets/*/versions/latest` is an alias to the most
    /// recently created
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AccessSecretVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::AccessSecretVersionRequest::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::AccessSecretVersionRequest;
    /// let x = AccessSecretVersionRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for AccessSecretVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.AccessSecretVersionRequest"
    }
}

/// Response message for
/// [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]: crate::client::SecretManagerService::access_secret_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessSecretVersionResponse {
    /// The resource name of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
    /// `projects/*/secrets/*/versions/*` or
    /// `projects/*/locations/*/secrets/*/versions/*`.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub name: std::string::String,

    /// Secret payload
    pub payload: std::option::Option<crate::model::SecretPayload>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AccessSecretVersionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::AccessSecretVersionResponse::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::AccessSecretVersionResponse;
    /// let x = AccessSecretVersionResponse::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [payload][crate::model::AccessSecretVersionResponse::payload].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::AccessSecretVersionResponse;
    /// use google_cloud_secretmanager_v1::model::SecretPayload;
    /// let x = AccessSecretVersionResponse::new().set_payload(SecretPayload::default()/* use setters */);
    /// ```
    pub fn set_payload<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::SecretPayload>,
    {
        self.payload = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [payload][crate::model::AccessSecretVersionResponse::payload].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::AccessSecretVersionResponse;
    /// use google_cloud_secretmanager_v1::model::SecretPayload;
    /// let x = AccessSecretVersionResponse::new().set_or_clear_payload(Some(SecretPayload::default()/* use setters */));
    /// let x = AccessSecretVersionResponse::new().set_or_clear_payload(None::<SecretPayload>);
    /// ```
    pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::SecretPayload>,
    {
        self.payload = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for AccessSecretVersionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.AccessSecretVersionResponse"
    }
}

/// Request message for
/// [SecretManagerService.DeleteSecret][google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret]: crate::client::SecretManagerService::delete_secret
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteSecretRequest {
    /// Required. The resource name of the
    /// [Secret][google.cloud.secretmanager.v1.Secret] to delete in the format
    /// `projects/*/secrets/*`.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub name: std::string::String,

    /// Optional. Etag of the [Secret][google.cloud.secretmanager.v1.Secret]. The
    /// request succeeds if it matches the etag of the currently stored secret
    /// object. If the etag is omitted, the request succeeds.
    ///
    /// [google.cloud.secretmanager.v1.Secret]: crate::model::Secret
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteSecretRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteSecretRequest::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::DeleteSecretRequest;
    /// let x = DeleteSecretRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteSecretRequest::etag].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::DeleteSecretRequest;
    /// let x = DeleteSecretRequest::new().set_etag("example");
    /// ```
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DeleteSecretRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.DeleteSecretRequest"
    }
}

/// Request message for
/// [SecretManagerService.DisableSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion]: crate::client::SecretManagerService::disable_secret_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DisableSecretVersionRequest {
    /// Required. The resource name of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to disable in
    /// the format `projects/*/secrets/*/versions/*` or
    /// `projects/*/locations/*/secrets/*/versions/*`.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub name: std::string::String,

    /// Optional. Etag of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request
    /// succeeds if it matches the etag of the currently stored secret version
    /// object. If the etag is omitted, the request succeeds.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DisableSecretVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DisableSecretVersionRequest::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::DisableSecretVersionRequest;
    /// let x = DisableSecretVersionRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DisableSecretVersionRequest::etag].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::DisableSecretVersionRequest;
    /// let x = DisableSecretVersionRequest::new().set_etag("example");
    /// ```
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DisableSecretVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.DisableSecretVersionRequest"
    }
}

/// Request message for
/// [SecretManagerService.EnableSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion]: crate::client::SecretManagerService::enable_secret_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnableSecretVersionRequest {
    /// Required. The resource name of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to enable in
    /// the format `projects/*/secrets/*/versions/*` or
    /// `projects/*/locations/*/secrets/*/versions/*`.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub name: std::string::String,

    /// Optional. Etag of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request
    /// succeeds if it matches the etag of the currently stored secret version
    /// object. If the etag is omitted, the request succeeds.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EnableSecretVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::EnableSecretVersionRequest::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::EnableSecretVersionRequest;
    /// let x = EnableSecretVersionRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::EnableSecretVersionRequest::etag].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::EnableSecretVersionRequest;
    /// let x = EnableSecretVersionRequest::new().set_etag("example");
    /// ```
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for EnableSecretVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.EnableSecretVersionRequest"
    }
}

/// Request message for
/// [SecretManagerService.DestroySecretVersion][google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion].
///
/// [google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion]: crate::client::SecretManagerService::destroy_secret_version
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DestroySecretVersionRequest {
    /// Required. The resource name of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to destroy in
    /// the format `projects/*/secrets/*/versions/*` or
    /// `projects/*/locations/*/secrets/*/versions/*`.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub name: std::string::String,

    /// Optional. Etag of the
    /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request
    /// succeeds if it matches the etag of the currently stored secret version
    /// object. If the etag is omitted, the request succeeds.
    ///
    /// [google.cloud.secretmanager.v1.SecretVersion]: crate::model::SecretVersion
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DestroySecretVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DestroySecretVersionRequest::name].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::DestroySecretVersionRequest;
    /// let x = DestroySecretVersionRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DestroySecretVersionRequest::etag].
    ///
    /// # Example
    /// ```
    /// # use google_cloud_secretmanager_v1::model::DestroySecretVersionRequest;
    /// let x = DestroySecretVersionRequest::new().set_etag("example");
    /// ```
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DestroySecretVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.secretmanager.v1.DestroySecretVersionRequest"
    }
}
